#include<iostream>
#include<algorithm>
#include<unordered_map>

//12 5
// 2 5 3 1 3 2 4 1 1 5 4 3

using namespace std;
const int N=1000000;
int  a[N];

int main()
{
    int n,m;   cin>>n>>m;
    int x,y;
    for(int i=1;i<=n;i++)   cin>>a[i];
    int left=1;
    int right=1;
    int ret=1000000;
    unordered_map<int,int>mp;
    while(right<=n)
    {
        mp[a[right]]++;
        while(mp.size()==m)
        {
            if(ret>right-left+1)
            {
                ret=right-left+1;
                x=left;
                y=right;
            }
            mp[a[left]]--;
            if(mp[a[left]]==0)
            {
                mp.erase(a[left]);
            }
             left++;
        }
        right++;
    }
    cout<<x<< " " <<y<<endl;
}